/***********************************************
 * Title:       IbatisSpecialityRecordDao.java
 * Description: IbatisSpecialityRecordDao.java
 * Author:      Niyuzhe
 * Create Date: 2009-12-18
 * CopyRight:   CopyRight(c)@2009
 * Company:     TJUSCS
 * Version:     1.0
 ***********************************************
 */
package edu.tju.education;

import java.sql.SQLException;
import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;

/**
 * @author Niyuzhe
 *
 */
public class IbatisSpecialityRecordDao implements ISpecialityRecordDao
{

        protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();
        
        /* (non-Javadoc)
         * @see edu.tju.education.ISpecialityRecordDao#getSpecialityRecordById()
         */
        public SpecialityRecord getSpecialityRecordById( long id ) throws SQLException
        {
                return (SpecialityRecord) sqlMap.queryForObject("getSpecialityRecordById", id);
        }

        /* (non-Javadoc)
         * @see edu.tju.education.ISpecialityRecordDao#getSpecialityRecordAnd(edu.tju.education.SpecialityRecord)
         */
        public List<SpecialityRecord> getSpecialityRecordAnd(SpecialityRecord specialityRecord)
                        throws SQLException
        {
                return sqlMap.queryForList("getSpecialityRecordAnd", specialityRecord);
        }

        /* (non-Javadoc)
         * @see edu.tju.education.ISpecialityRecordDao#getSpecialityRecordOr(edu.tju.education.SpecialityRecord)
         */
        public List<SpecialityRecord> getSpecialityRecordOr(SpecialityRecord specialityRecord)
                        throws SQLException
        {
                return sqlMap.queryForList("getSpecialityRecordOr", specialityRecord);
        }

        /* (non-Javadoc)
         * @see edu.tju.education.ISpecialityRecordDao#insertSpecialityRecord(edu.tju.education.SpecialityRecord)
         */
        public Long insertSpecialityRecord(SpecialityRecord specialityRecord) throws SQLException
        {
                return (Long)sqlMap.insert("insertSpecialityRecord", specialityRecord);                
        }

        /* (non-Javadoc)
         * @see edu.tju.education.ISpecialityRecordDao#updateSpecialityRecord(edu.tju.education.SpecialityRecord)
         */
        public int updateSpecialityRecord(SpecialityRecord specialityRecord) throws SQLException
        {
                return sqlMap.update("updateSpecialityRecord", specialityRecord);
                
        }

        /* (non-Javadoc)
         * @see edu.tju.education.ISpecialityRecordDao#deleteSpecialityRecord(long)
         */
        public int deleteSpecialityRecord(long id) throws SQLException
        {
                return sqlMap.delete("deleteSpecialityRecord", id);
        }

}
